package com.ts.admin.modules.content;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ts.common.core.utils.Result;
import com.ts.feign.api.CategoryService;
import com.ts.feign.dto.CategoryDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/category")
public class CategoryController {

    @Autowired
    private CategoryService categoryService;

    @PostMapping("/page")
    public Result<CategoryDTO> page(@RequestBody Page<CategoryDTO> page){
        Page<CategoryDTO> page1 = categoryService.page(page);
        return new Result().ok(page1);
    }

    @PostMapping("save")
    public Result save(@RequestBody CategoryDTO categoryDTO){
        categoryService.save(categoryDTO);
        return new Result();
    }
}
